package com.emergency.service.impl;

import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.emergency.data.entity.TeamType;
import com.emergency.data.vo.TeamTypeVO;
import com.emergency.mapper.TeamTypeMapper;
import com.emergency.service.TeamTypeService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.stream.Collectors;

/**
 * (TeamType)救援队伍类型服务实现类
 *
 * @author makejava
 * @since 2020-09-21
 */
@Service
public class TeamTypeServiceImpl extends ServiceImpl<TeamTypeMapper, TeamType> implements TeamTypeService {

    @Resource
    private TeamTypeMapper teamTypeMapper;

    @Override
    public List<TeamTypeVO> getTeamTypeList() {
        return teamTypeMapper.selectList(null).stream().map(c -> {
            TeamTypeVO vo = new TeamTypeVO();
            BeanUtil.copyProperties(c, vo);
            return vo;
        }).collect(Collectors.toList());
    }
}
